package com.core.comment;

import java.util.List;
import java.util.UUID;

public class StringUtil {

    /**
     * 获取uuid
     *
     * @return
     */
    public static String getUuid() {
        String uuid = UUID.randomUUID().toString().replaceAll("-", "");
        return uuid;
    }

    /**
     * 判断是否为空字符串
     *
     * @param s
     * @return
     */
    public static boolean isBlack(String s) {
        if (s == null) {
            return true;
        }
        if ("".equals(s.trim()) || "null".equals(s.trim())) {
            return true;
        }
        return false;
    }

    public static boolean isEmpty(String s) {
        return isBlack(s);
    }

    /**
     * 判断是否为空字符串
     *
     * @param s
     * @return
     */
    public static boolean isNotBlack(String s) {
        return !isBlack(s);
    }

    /**
     * 逗号拼接字符串
     *
     * @param list
     * @return
     */
    public static String join(List<String> list) {
        String[] args = list.toArray(new String[list.size()]);
        return String.join(",", args);
    }
}
